package com.shared.server.impl;

import com.shared.dao.POrderItemMapper;
import com.shared.dao.POrdersMapper;
import com.shared.pojo.POrderItem;
import com.shared.pojo.POrders;
import com.shared.server.POrdersServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class POrdersServerImpl implements POrdersServer {
    @Autowired
    private POrdersMapper pOrdersMapper;
    @Autowired
    private POrderItemMapper pOrderItemMapper;

    @Override
    public void addOrder(POrders pOrders) {
        this.pOrdersMapper.insert(pOrders);
    }

    @Override
    public void assOrderItem(POrderItem pOrderItem) {
        this.pOrderItemMapper.insert(pOrderItem);
    }

    @Override
    public void updateCountById(Integer id, Integer count) {
        this.pOrdersMapper.updateCountById(id, count);

    }

    @Override
    public List<POrders> findOrderByUserid(Integer userid) {
        return pOrdersMapper.findOrderByUserid(userid);
    }

    @Override
    public List<POrders> getOrders() {
        return pOrdersMapper.findOrder();
    }

    @Override
    public List<POrderItem> findoRderItemByOrderid(Integer orderid) {
        return pOrdersMapper.findoRderItemByOrderid(orderid);
    }

    @Override
    public List<POrders> findorderByOrderno(String orderno) {
        return pOrdersMapper.findorderByOrderno(orderno);
    }

    @Override
    public void updateOrderState(String orderno, Integer state) {
        this.pOrdersMapper.updateOrderState(orderno, state);
    }

}
